import { HYEventStore } from "hy-event-store"
import { getPlaylistdetail } from "../serive/music"

const rankingIds = {
    newRanking:3779629,
    originRanking:2884035,
    upRanking:19723756,
    hotRanking:3778678
}
const rankingStore = new HYEventStore({
    state:{
        newRanking: {},
        originRanking: {},
        upRanking: {},
        hotRanking: {}
    },
    actions:{
        fetchSongRankingAction(ctx) {
            for (let key in rankingIds) {
                getPlaylistdetail(rankingIds[key]).then(res => {
                    ctx[key] = res.playlist
                })
            }
        }
    }
})

export default rankingStore
